﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//using Microsoft.VisualStudio.TestTools.UnitTesting;

//using Pibby.Core.IO;
//using Pibby.Core.Models;
//using Pibby.Core.Presenters;
//using Pibby.Core.Views;

//namespace Pibby.Core.Tests
//{
//    [TestClass]
//    //[TestCategory("Long Running")]
//    public class PodcatcherPresenterTests : IntegrationBaseTestFixture
//    {
//        private Stubs.PodcatcherView _view;
//        private PodcatcherModel _model;
//        private PodcatcherPresenter _presenter;

//        [TestInitialize]
//        public override void Setup()
//        {
//            base.Setup();

//            string docsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
//            IFolder baseFolder = new Stubs.Folder(docsPath, 25, 0);

//            IFolder defaultDownloadPath = baseFolder.Append("Podcasts");
//            IFolder defaultSettingsPath = baseFolder.Append("Settings");
//            IFolder defaultRepositoryPath = baseFolder.Append("Repository");

//            this._view = new Stubs.PodcatcherView();

//            string settingsFileName = "Application.cfg";
//            string repositoryFileName = ":memory:";

//            IFolderCollection searchPaths = new IFolderCollection();
//            searchPaths.Add(defaultSettingsPath);
//            searchPaths.Add(defaultRepositoryPath);

//            this._model = new PodcatcherModel();
			
//            this._model.LoadSettings (settingsFileName, 
//                                            searchPaths, 
//                                            defaultSettingsPath, 
//                                            defaultDownloadPath);

//            this._model.Settings.MainWindow.Left = 0;
//            this._model.Settings.MainWindow.Top = 0;
//            this._model.Settings.MainWindow.Width = 640;
//            this._model.Settings.MainWindow.Height = 480;
//            this._model.Settings.MainWindow.SplitterDistance = 120;
//            this._model.Settings.MainWindow.CurrentView = 2;

//            this._model.Settings.RepositoryPath = repositoryFileName;

//            this._model.LoadRepository(repositoryFileName,
//                                            searchPaths,
//                                            defaultRepositoryPath);

//            this._presenter = new PodcatcherPresenter(this._view, this._model);
//        }

//        [TestCleanup]
//        public override void TearDown()
//        {
//            base.TearDown();

//            this._presenter.UnsubscribeToClientEvents();
//        }

//        [TestMethod]
//        public void AtStartup_SettingsLoaded_MainWindowPositioned()
//        {
//            this._view.SimulateLoadEvent();

//            Assert.AreEqual(this._model.Settings.MainWindow.Left, this._view.Left);
//            Assert.AreEqual(this._model.Settings.MainWindow.Top, this._view.Top);
//            Assert.AreEqual(this._model.Settings.MainWindow.Width, this._view.Width);
//            Assert.AreEqual(this._model.Settings.MainWindow.Height, this._view.Height);
//            Assert.AreEqual(this._model.Settings.MainWindow.SplitterDistance, this._view.SplitterDistance);
//            Assert.AreEqual(this._model.Settings.MainWindow.CurrentView, this._view.CurrentView);
//        }

//        [TestMethod]
//        public void WhenClosing_MostRecentSettings_Saved()
//        {
//            this._view.Left = 10;
//            this._view.Top = 50;
//            this._view.Width = 600;
//            this._view.Height = 250;
//            this._view.SplitterDistance = 95;
//            this._view.CurrentView = 4;

//            this._view.SimulateClosingEvent();

//            Assert.AreEqual(this._view.Left, this._model.Settings.MainWindow.Left);				
//            Assert.AreEqual(this._view.Top, this._model.Settings.MainWindow.Top);				
//            Assert.AreEqual(this._view.Width, this._model.Settings.MainWindow.Width);				
//            Assert.AreEqual(this._view.Height, this._model.Settings.MainWindow.Height);
//            Assert.AreEqual(this._view.SplitterDistance, this._model.Settings.MainWindow.SplitterDistance);
//            Assert.AreEqual(this._view.CurrentView, this._model.Settings.MainWindow.CurrentView);
//        }

//    }
//}
